package gui.creators;

import events.antEvents.MarkCreatedEvent;
import events.antEvents.MarkDestroyedEvent;
import framework.events.Event;
import framework.gui.GUI;
import framework.gui.GUIObject;
import framework.gui.GUIObjectCreator;
import gui.objects.GUIMark;

public class GUIMarkCreator extends GUIObjectCreator {

	public GUIMarkCreator(GUI gui) {
		super(gui);
	}

	@Override
	protected GUIObject createGUIObject(Event event) {
		if (event instanceof MarkCreatedEvent) {
			MarkCreatedEvent e = (MarkCreatedEvent) event;
			return new GUIMark(e.getId(), e.getPosition());
		} else {
			throw new IllegalStateException();
		}
	}

	@Override
	protected Class<? extends Event> getCreationEventClass() {
		return MarkCreatedEvent.class;
	}

	@Override
	protected Class<? extends Event> getDestroyEventClass() {
		return MarkDestroyedEvent.class;
	}

	@Override
	protected GUIObject getDestroyGUIObject(Event event) {
		if (event instanceof MarkDestroyedEvent) {
			MarkDestroyedEvent e = (MarkDestroyedEvent) event;
			return new GUIMark(e.getId(), e.getPosition());
		} else {
			throw new IllegalStateException();
		}
	}
}
